#include<iostream>
#include<cstring>
using namespace std;
const int N = 110;
char map[N][N];
bool st[N][N];
int k, n;

int dx[] = { -1,0,1,0 };
int dy[] = { 0,1,0,-1 };
bool dfs(int x1, int y1, int x2, int y2)
{
	if (x1 == x2 && y1 == y2) {
		return 1;
	}
	st[x1][y1] = 1;
	for (int i = 0; i < 4; i++) {
		int a = x1 + dx[i];
		int b = y1 + dy[i];
		if (a < 0 || a >= n || b < 0 || b >= n)continue;
		if (map[a][b] == '#')continue;
		if (!st[a][b]) {
			if (dfs(a, b, x2, y2)) {
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	cin >> k;
	while (k--) {
		cin >> n;
		memset(map, ' ', sizeof(map));
		memset(st, 0, sizeof(st));
		for (int i = 0; i < n; i++) {
			cin >> map[i];
		}
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		if (map[x1][y1] == '#' || map[x2][y2] == '#') {
			cout << "NO" << endl;
			continue;
		}
		else {
			puts(dfs(x1, y1, x2, y2) ? "YES" : "NO");
		}
	}
	return 0;
}